#define BRICKWIDTH 0.25
#define BRICKHEIGHT 0.08
#define MOTARTHICKNESS 0.01

#define BMWIDTH (BRICKWIDTH + MOTARTHICKNESS)
#define BMHEIGHT (BRICKHEIGHT + MOTARTHICKNESS)

#define MWF (MOTARTHICKNESS * 0.5 / BMWIDTH)
#define MHF (MOTARTHICKNESS * 0.5 / BMHEIGHT)

void main(){
	
	float scoord = gl_TexCoord[0].x;
	float tcoord = gl_TexCoord[0].y;
	
	float ss = mod(scoord / BMWIDTH, 1.0);
	float tt = tcoord / BMHEIGHT;
	
	if(mod(tt, 2.0) > 1.0)ss += 0.5;
	
	float sbrick = floor(ss);
	float tbrick = floor(tt);
	
	ss -= sbrick;
	tt -= tbrick;
	
	float w = step(MWF,ss) - step(1.0 - MWF,ss);
	float h = step(MHF,tt) - step(1.0 - MHF,tt);
	
	gl_FragColor = vec4(w * h, w * h, 0.0, 1.0);
	
}